from django import forms

from .models import Topic,Blog,Comment

from mdeditor.widgets import MDEditorWidget

class TopicForm(forms.ModelForm):
	class Meta:
		model = Topic
		fields = ['text']
		labels = {'text':'主题'}

class BlogForm(forms.ModelForm):
	class Meta:
		model = Blog
		fields = ['title','text']
		labels = {'text':'正文（支持markdown）','title':'标题'}
		widgets = {'text':MDEditorWidget()}
		
class CommentForm(forms.ModelForm):
	class Meta:
		model = Comment
		fields = ['text']
		labels = {'text':'评论（最多512个汉字）'}
		widgets = {'text':forms.Textarea(attrs={'cols':80})}
